/**
 * Copyright 2016-2017 TVI Go Easy.
 * Created on 2017/4/18 14:32
 */
package org.mechanic.fund.domain.product;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.mechanic.fund.domain.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 产品净值实体类
 *
 * @author mechanic
 * @version 0.0.1
 */
@Entity
public class ProductNetvalue extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -3889334906172823601L;

    /**
     * 产品编号
     */
    @JsonIgnoreProperties({
      "parentId",
      "productStatus",
      "code",
      "productType",
      "isHotSelling",
      "isAssociation",
      "productStyle",
      "investmentManager",
      "level",
      "startMoney",
      "managerType",
      "managerName",
      "trusteeType",
      "trusteeName",
      "conditions",
      "issueBeginDate",
      "issueEndDate",
      "registerDate",
      "currency",
      "closePeriod",
      "expires",
      "recommendBeginDate",
      "recommendEndDate",
      "redemption",
      "productStocksIndexType",
      "newestNetvalue",
      "newestTotalNetvalue",
      "netvalueDate",
      "buyFee",
      "redemptionFee",
      "trusteeshipFee",
      "floatFee",
      "otherFee",
      "fixedFee",
      "openDate",
      "investmentScope",
      "recommendReason",
      "isDisclaimers",
      "remark"
    })
    @ManyToOne
    @JoinColumn(name = "product_id")
    private Product product;
    /**
     * 净值日期
     */
    @Column(name = "newest_date", columnDefinition = "TIMESTAMP")
    private LocalDate newestDate;
    /**
     * 最新单位净值
     */
    @Column(name = "unit_netvalue")
    private BigDecimal unitNetvalue;
    /**
     * 累计单位净值
     */
    @Column(name = "")
    private BigDecimal totalUnitNetvalue;

    public ProductNetvalue() {
    }

    public ProductNetvalue(
      String id,
      Product product,
      LocalDate newestDate,
      BigDecimal unitNetvalue,
      BigDecimal totalUnitNetvalue,
      String createUser,
      LocalDateTime createTime,
      String updateUser,
      LocalDateTime updateTime) {
        this.id = id;
        this.product = product;
        this.newestDate = newestDate;
        this.unitNetvalue = unitNetvalue;
        this.totalUnitNetvalue = totalUnitNetvalue;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public LocalDate getNewestDate() {
        return newestDate;
    }

    public void setNewestDate(LocalDate newestDate) {
        this.newestDate = newestDate;
    }

    public BigDecimal getUnitNetvalue() {
        return unitNetvalue;
    }

    public void setUnitNetvalue(BigDecimal unitNetvalue) {
        this.unitNetvalue = unitNetvalue;
    }

    public BigDecimal getTotalUnitNetvalue() {
        return totalUnitNetvalue;
    }

    public void setTotalUnitNetvalue(BigDecimal totalUnitNetvalue) {
        this.totalUnitNetvalue = totalUnitNetvalue;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
